package com.dong.repeatsubmit.redis;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

@Service
public class RedisService {
    @Autowired
    RedisTemplate<String, Object> redisTemplate;

    public final static String JOINER = ":";

    protected String getKey(String key) {
        return key;
    }

    protected String bulidKey(String active, String prefix, String key) {
        if (prefix != null && prefix.endsWith(JOINER)) {
            prefix = prefix.substring(0, prefix.length() - 1);
        }
        return active + JOINER + prefix + JOINER + key;
    }
}
